#define _CRT_SECURE_NO_WARNINGS
#include <stdio.h>
long long factorial(int n);

int main() {
    int N;
    long long sum = 0;
    scanf("%d", &N);
    for (int i = 1; i <= N; i++) {
        sum += factorial(i);
    }
    printf("%lld\n", sum);

    return 0;
}
long long factorial(int n) {
    long long fact = 1;
    for (int i = 1; i <= n; i++) {
        fact *= i;
    }
    return fact;
}
